home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_12_03
/
kamradt
/
empty.h
< prev
next >
Wrap
C/C++ Source or Header
|
1994-02-07
|
692b
|
40 lines
class AttributeList {
private:
struct AttributeListImp {
int *list;
unsigned count;
AttributeListImp(int *
data, unsigned size)
{
list = new int[size];
memcpy(list,data,
sizeof(int)*size);
count = 1;
}
} *ptr;
public:
AttributeList()
{
// Empty list special case:
ptr = NULL;
}
AttributeList(int *data,
unsigned size)
{
ptr = new
AttributeListImp(data,
size);
}
AttributeList(const
AttributeList &a)
{
// Now we have to check
// for null:
ptr = a.ptr;
if(ptr) ptr->count++;
}
...
};